<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<html>
<head>
    <title>Title</title>
    <!-- 新 Bootstrap 核心 CSS 文件 -->
    <link href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-3.6.0.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/linkageProvinceCity.js"></script>
</head>
<body>
<div class="container">
    <div class="page-header">
        <h3>更新路线信息</h3>
    </div>
    <div class="row clearfix">
        <div class="col-md-12 column">
            <form action="${pageContext.request.contextPath}/admin/updatePath" method="post" enctype="multipart/form-data">
                <%--隐藏域--%>
                <input type="hidden" name="pid" value="${PageInfo.pid}">
                    <div class="form-group">
                        <label for="pathname">路线名</label>
                        <input type="text" name="pathname" class="form-control" id="pathname" value="${PageInfo.pathname}" required>
                    </div>
                    <div class="form-group">
                        <label for="selectProv">省份</label>
                        <select id="selectProv" onchange="prov_onChange()" name="province"  class="form-select" aria-label="Default select example">
                            <option>${PageInfo.province}</option>
                        </select>

                    </div>
                    <div class="form-group">
                        <label for="selectProv">城市</label>
                        <select id="selectCity" onchange="city_onChange()" name="city" class="form-select" aria-label="Default select example">
                            <option>${PageInfo.city}</option>
                        </select>
                    </div>

                    <div class="form-group">
                        <label for="daytime">日期</label>
                        <input type="text" name="daytime" class="form-control" id="daytime" value="${PageInfo.daytime}" required>
                    </div>
                    <div class="form-group">
                        <label for="price">价格</label>
                        <input type="text" name="price" class="form-control" id="price" value="${PageInfo.price}" required>
                    </div>
                    <div class="form-group">
                        <label for="intro">简介</label>
                        <input type="text" name="intro" class="form-control" id="intro" value="${PageInfo.intro}" required>
                    </div>
                    <div class="form-group">
                        <label for="file">图片</label>
                        <img src="${pageContext.request.contextPath}/upload/${PageInfo.pics}">
                        <input type="file" name="file" class="form-control" id="file" value="${file}">
                    </div>
                    <div class="form-group">
                        <label for="descr">描述</label>
                        <input type="text" name="descr" class="form-control" id="descr" value="${PageInfo.descr}" required>
                    </div>
                    <div class="form-group">
                        <label for="selectStatus">状态</label>
                        <select id="selectStatus" name="status">
                            <option value="1">上架</option>
                            <option value="2">修改</option>
                            <option value="3">下架</option>
                        </select>

                    </div>
                    <button type="submit" class="btn btn-default">Submit</button>

            </form>
        </div>
    </div>

    <div class="page-header">
        <h3>更新图片</h3>
    </div>
    <div class="row clearfix">
        <c:forEach var="pic" items="${PageInfo.picture}">
            <div class="col-md-4 column">
                <form action="${pageContext.request.contextPath}/admin/updatePathPic" method="post" enctype="multipart/form-data">
                        <%--隐藏域--%>
                    <input type="hidden" name="pid" value="${PageInfo.pid}">
                    <input type="hidden" name="picid" value="${PageInfo.picid}">
                    <div class="form-group">
                        <label for="newPicture">图片</label>
                        <img src="${pageContext.request.contextPath}/upload/${pic}">
                        <input type="hidden" name="oldPic" value="${pic}">
                        <input type="file" name="newPicture" class="form-control" id="newPicture">
                    </div>
                    <button type="submit" class="btn btn-default">Submit</button>
                    <a class="button" href="${pageContext.request.contextPath}/admin/deletePathPic?pid=${PageInfo.pid}&picid=${PageInfo.picid}&oldPic=${pic}">删除</a>
                </form>
            </div>
        </c:forEach>
    </div>


    <div class="page-header">
        <h3>添加图片</h3>
    </div>
    <div class="row clearfix">
        <div class="col-md-12 column">
            <form action="${pageContext.request.contextPath}/admin/addPathPic" method="post" enctype="multipart/form-data">
                <%--隐藏域--%>
                <input type="hidden" name="pid" value="${PageInfo.pid}">
                <input type="hidden" name="picid" value="${PageInfo.picid}">
                <div class="form-group">
                    <label for="newPic">新照片</label>
                    <input type="file" id="newPic" name="newPic" class="form-control">
                </div>
                <button type="submit" class="btn btn-default">Submit</button>

            </form>
        </div>
    </div>




</div>

</body>
</html>
